<?php
	//news
	$parameters = array('num_rows');
	$this->data['news'] = $this->GetModelObject('News')->ListItemsPaged($this->request->get, '', $parameters);
	$this->data['num_rows'] = $parameters['num_rows'];

	//news
	echo "
	<ul style = 'width: 100%'>	
		<li class='mainbox white-corners'>
			<div class='box-header clear'>
				<div class='box-title-blue fl_left'>".Language::Get("News")." <a href = '/news/rss/' target = '_blank' style = 'margin-left: 5px; '><img src = '".SITE_IMAGES."rss.gif' /></a></div>
				<div class='box-control fl_right'></div>
			</div>
			<div class='box-cnt'>";
	
			//list
			foreach ($this->data['news'] as $new)
			{
				//title and text
				$nameStripped = strip_tags($new['name_'.Language::getShortName()]);
				$textStripped = strip_tags($new['text_'.Language::getShortName()]);
				$newsName = (!empty($nameStripped)) ? $new['name_'.Language::getShortName()] : $new['name_ru'];
				$newsText = (!empty($textStripped)) ? $new['text_'.Language::getShortName()] : $new['text_ru'];
				
				//image
				if (!empty($new['image']))
				{
					$image = "<img src='/././app/upload/news/".$new['id'].'/thumbs/'.$new['image']."' alt='$newsName' align = 'left' style = 'margin: 0px 10px 10px 0px; ' />";
					$hasImage = true;
				}
				else
				{
					$image = "";
					$hasImage = false;
				}				
				
				echo "
					<div>
						<div style = 'float: left; '>$image</div>
						<div class = 'listTitle'>{$newsName}</div>
						<div class = 'listText'>{$newsText}</div>
						<br clear = 'both' />
						<div class = 'listDate'>".String::ToDateFormat($new['date'])."</div>
					</div>
					<br clear = 'both' />
				";
			}
	
			//pagination
			echo HtmlsHelper::Pagination($this->data['num_rows']);
			
	echo "	</div>
		</li>
	</ul>";
?>